package com.yvon.core.result;

/**
 * 常用API操作码
 *
 * @author yvon
 * @date 2020-06-08
 */
public enum ResultCode implements IErrorCode {
    SUCCESS(200, "操作成功"),
    FAILED(500, "操作失败"),
    VALIDATE_FAILED(404, "参数校验失败"),
    UNAUTHORIZED(401, "暂未登录或token已过期"),
    FORBIDDEN(403, "权限不足"),
    GLOBAL_EXCEPTION(-1, "系统出现错误，请稍后重试！"),
    BUSY(-2, "系统繁忙，请稍后重试！"),
    TIMEOUT(-3, "系统超时，请稍后重试！"),
    ILLEGAL_ARGUMENT(50000, "参数违法"),
    INVALID_PARAMETER(90000, "请求参数不符合条件，请核实后重试！"),
    INVALID_OPERATE(90001, "操作失败，请重试！");

    private Integer code;
    private String message;

    private ResultCode(Integer code, String message){
        this.code = code;
        this.message = message;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}